@extends('store::modal')
@section('content')
    <div class="row mb-5"><div class="col-sm-12">
            @component('store::component.form.form')
                @slot('action') {{$url}} @endslot
                @slot('formId') goods @endslot
                @component('store::component.form.form-group')
                    @slot('title') 发货人 @endslot
                    @slot('is_must') true @endslot
                    @component('store::component.form.input')
                        @slot('name') consignor @endslot
                        @slot('value') {{$info->consignor ?? ''}} @endslot
                    @endcomponent
                @endcomponent
                @component('store::component.form.form-group')
                    @slot('title') 联系方式 @endslot
                    @slot('is_must') true @endslot
                    @component('store::component.form.input')
                        @slot('name') phone @endslot
                        @slot('value') {{$info->phone ?? ''}} @endslot
                    @endcomponent
                @endcomponent

                @component('store::component.form.form-group')
                    @slot('title') 邮编 @endslot
                    @component('store::component.form.input')
                        @slot('name') zip_code @endslot
                        @slot('value') {{$info->zip_code ?? ''}} @endslot
                    @endcomponent
                @endcomponent
                     @component('store::component.form.form-group')
                           @slot('title') 地区 @endslot
                               <div class="layui-form layui-form-pane">
                                   <div class="layui-form-item post-area" lay-filter="post-area"></div>
                               </div>
                     @endcomponent

                @component('store::component.form.form-group')
                    @slot('title') 详细地址 @endslot
                    @component('store::component.form.textarea')
                        @slot('name') address @endslot
                        @slot('row') 2 @endslot
                        @slot('value') {{$info->address??''}} @endslot
                    @endcomponent
                @endcomponent

                    @component('store::component.form.form-group')
                        @slot('title') 默认 @endslot
                        <div>
                            @foreach(['0'=>'否','1'=>'是'] as $value=>$title)
                                @component('store::component.radio')
                                    @slot('title') {{$title}} @endslot
                                    @slot('name') is_default @endslot
                                    @slot('value') {{$value}} @endslot
                                    @if($value == ($info->is_default ?? 0))
                                        @slot('checked') checked @endslot
                                    @endif
                                @endcomponent
                            @endforeach
                        </div>
                    @endcomponent
                @component('store::component.form.form-group')
                    @slot('class') text-left m-b-0 @endslot
                    @component('store::component.form.button')
                        @slot('title')确定@endslot
                        @slot('size') md @endslot
                        @slot('color') danger @endslot
                        @slot('params') {"formId":"#goods"} @endslot
                        @slot('class')ajax-form @endslot
                    @endcomponent
                    @component('store::component.form.button')
                        @slot('title') 重置 @endslot
                        @slot('size') md @endslot
                        @slot('color') primary @endslot
                    @endcomponent
                @endcomponent
            @endcomponent
    </div></div>
@endsection
@push('scripts')
    <script>
        layui.use(['interact'], function(){
            var selected = "{{$info->area ?? ''}}";
            if(selected !=''){
                selected = selected.split(',')
            }else{
                selected = [3,37,38];
            }
            $.get("{{route('Store_getArea')}}",function (response) {
                var interact = layui.interact;
                interact.render({
                    elem : '.post-area',
                    data : response,
                    name : 'area',
                    selected:selected,
                    hint : ['请选择省份','请选择城市','请选择县/区'],
                });
            });

        });
    </script>
@endpush